﻿<%@ Page Title="修改密码" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" AutoEventWireup="true" CodeBehind="ChangePassword.aspx.cs" Inherits="RegexLib.Web.Views.Member.ChangePassword" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<div class="box">
	<div class="bt">修改密码</div>
	<div class="bc">
	<form id="ChangeForm" action="/Member/ChangePasswordSubmit/" method="post">
		<p>请输入您的Email地址：<input type="text" class="input" name="userEmail" maxlength="256" /></p>
	</form>
	<div><button id="SubmitBtn">提交申请</button></div>
	<p><span id="MsgSpan"></span></p>
	</div>
</div>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ScriptPlaceHolder" runat="server">
<script type="text/javascript">
var c_ChangeForm;
var c_SubmitBtn;
var c_MsgSpan;

function GetElements()
{
	c_ChangeForm = YAHOO.util.Dom.get("ChangeForm");
	c_SubmitBtn = YAHOO.util.Dom.get("SubmitBtn");
	c_MsgSpan = YAHOO.util.Dom.get("MsgSpan");
}

function SubmitFail(o)
{
	c_MsgSpan.className = "err";
	c_MsgSpan.innerText = "连接错误。" + o.statusText;
	c_SubmitBtn.disabled = false;
}

function SubmitSuccess(o)
{
	try
	{
		var data = YAHOO.lang.JSON.parse(o.responseText);
		if(data.IsError)
			c_MsgSpan.className = "err";
		else
		{
			c_MsgSpan.className = "suc";
			c_ChangeForm.reset();
		}
			
		c_MsgSpan.innerText = data.Message;
	}
	catch(e)
	{
		c_MsgSpan.className = "err";
		c_MsgSpan.innerText = "解析响应时出错。";
	}
	c_SubmitBtn.disabled = false;
}

function DoSubmit()
{
	c_SubmitBtn.disabled = true;
	
	var callback =
	{
		success: SubmitSuccess,
		failure: SubmitFail,
		timeout: 30000
	};
	
	YAHOO.util.Connect.setForm(c_ChangeForm);
	YAHOO.util.Connect.asyncRequest("POST", "/Member/ChangePasswordSubmit/", callback, null);
}

function init()
{
	GetElements();
	YAHOO.util.Event.addListener(c_SubmitBtn, "click", DoSubmit);
}

YAHOO.util.Event.onDOMReady(init);
</script>
</asp:Content>
